package org.zebra.trans.core;

/**
 * @author zhanghongbin
 */
public class DefaultDictTranslation implements Translation<String> {

    @Override
    public String translation(String key, String readConverterExp, Object value) {
        String[] expArray = readConverterExp.split(",");
        // (如:0=男,1=女,2=未知)
        if (expArray.length == 0) {
            return "";
        }
        for (String exp : expArray) {
            String[] contentArray = exp.split("=");
            if (contentArray[0].trim().equals(value.toString())) {
                return contentArray[1].trim();
            }
        }
        return "";
    }
}
